﻿CREATE PROCEDURE [dbo].[Hogar_Remito_Insertar]   
	@NumeroRemito VARCHAR(50),
	@FechaEntrega DATE,
	@ProveedorId INT,
	@Observacion VARCHAR(255)
AS 
BEGIN

/*****************************************************************************************************************************************/
-- Author: Carlos Mendoza
-- Purpose:   crea un nuevo remito
-- Returns:    Remito
/*****************************************************************************************************************************************/ 
	
	DECLARE @RemitoId int

	INSERT INTO [dbo].[Remito]
				(NumeroRemito,
				FechaEntrega,
				ProveedorId,
				Observacion)
	VALUES (@NumeroRemito, @FechaEntrega, @ProveedorId, @Observacion)

	SET @RemitoId = IDENT_CURRENT('Remito')

	SELECT  [RemitoId],
			[NumeroRemito],
			[FechaEntrega],
			[ProveedorId],
			[Observacion]
	FROM	[dbo].[Remito] WITH (NOLOCK)
	WHERE [RemitoId] = @RemitoId
	
END